<!DOCTYPE html>
<!-- saved from url=(0039)http://c.tsz90.com/home/task/add?type=3 -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php echo $res['type'] ?></title>
<link rel="stylesheet" href="__PUBLIC__/static/css/renwu/taskdatail.css">
<!-- 弹出层 -->
<script src="__PUBLIC__/static/js/renwu/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/js/renwu/public.js"></script>
</head>
<body style="background: rgb(255, 255, 255);">
<header class="bg_header" data-id='<?php echo $res['uid'] ?>'>
	<a onclick="history.back()" class="left"><img src="__PUBLIC__/static/js/renwu/icon_back.png" alt=""></a>
	<?php echo $res['type'] ?>	<!-- <a href="#" class="right"><img src="/static/home/mobile/images/icon_add.png" alt=""></a> -->
</header>

<div class="basic_infor">
	<div class="container">
		<h3 class="release_title">填写基本信息</h3>
		<div class="infor_card ">
			<div class="inline_form2">
				<label for="">项目名称</label>
				<div class="right">
					<input type="text" name="pro_name" id="pro_name" class="task-txt new-add-task-content" placeholder="一般为APP或网站名字" value="">
				</div>
			</div>
			<div class="inline_form2">
				<label for="">悬赏标题</label>
				<div class="right">
					<input type="text" name="title" id="title" class="task-txt new-add-task-content" placeholder="请输入任务标题" value="">
				</div>
			</div>
			<div class="inline_form">
				<label for="">提交限时</label>
				<div class="right">
					<!-- 美化 -->
					<!-- <a href="javascript:void(0)"  class="sel_mask"><span id="sel01_span">限制<font>24</font>小时内提交</span> -->
					    
						<select style="display:inline;" class="sel" id="sel01" name="submittime">
                                                                <option value="1" selected="selected">
                                        限制1小时内提交
                                    </option>
                                                                    <option value="6">
                                        限制6小时内提交
                                    </option>
                                                                    <option value="12">
                                        限制12小时内提交
                                    </option>
                                                                    <option value="24">
                                        限制24小时内提交
                                    </option>
                                                                    <option value="48">
                                        限制48小时内提交
                                    </option>
                                                                    <option value="72">
                                        限制72小时内提交
                                    </option>
                                                        </select>
					
				</div>
			</div>
			<div class="inline_form">
				<label for="">审核周期</label>
				<div class="right">
					<!-- 美化 -->
					<!-- <a href="javascript:void(0)"  class="sel_mask"><span id="sel02_span">将在<font>24</font>小时内审核</span> -->
						<select style="display:inline;" class="sel" id="sel02" name="periodtime">
                                                                <option value="1">
                                    将在1小时内审核
                                    </option>
                                                                    <option value="6">
                                    将在6小时内审核
                                    </option>
                                                                    <option value="12">
                                    将在12小时内审核
                                    </option>
                                                                    <option value="24" selected="selected">
                                    将在24小时内审核
                                    </option>
                                                                    <option value="48">
                                    将在48小时内审核
                                    </option>
                                                                    <option value="72">
                                    将在72小时内审核
                                    </option>
                                                                    <option value="120">
                                    将在120小时内审核
                                    </option>
                                                        </select>
					
				</div>
			</div>
			<div class="inline_form2">
				<label for="">可以重做</label>
				<div class="right btns">
					<a href="javascript:;" data-chongzuo="2">否</a>
					<a href="javascript:;" class="active" data-chongzuo="1">是</a>
				</div>
			</div>
		</div>
		<div class="infor_card infor_card02">
			<div class="inline_form">
				<label for="">悬赏单价</label>
				<div class="right">
					<input type="text" data-fee="0.15" id="unit_price" name="unit_price" placeholder="请输入任务单价" class="task-txt" value="">
				</div>
			</div>
			<div class="inline_form">
				<label for="">悬赏名额</label>
				<div class="right">
					<input type="text" id="task_num" name="ticket_num" placeholder="请输入任务数量" class="task-txt" value="">
				</div>
			</div>
			<div class="inline_form">
				<label for="">预付赏金</label>
				<div class="right">
					<!-- <span style="color:red;" id="user_gold">0.00</span>元&nbsp;服务费
					<span style="color:red;" id="plat_gold">0.00</span>元 -->
					<input type="text" disabled="" id="count_money" name="give_credit2" class="task-txt" readonly="readonly" placeholder="共计0.0元(服务费0%)" value="">
				</div>
			</div>
		</div>
		<div class="next_step">
			<a id="btn_ds">下一步(设置步骤)</a>
		</div>
		<input type="hidden" name="category_id" id="category_id" value="3">
		<input type="hidden" name="service_charge" id="service_charge" value="0">
         
	</div>
</div>


<script>
	$(function(){
		 $('#sel01').change(function () {    // 选择后替换内容
	        $('#sel01_span').addClass("on").html($('#sel01').find('option:selected').html());
	    })
		  $('#sel02').change(function () {    // 选择后替换内容
	        $('#sel02_span').addClass("on").html($('#sel02').find('option:selected').html());
	    })
	  //是否切换切换
		$('.infor_card .btns a').click(function(){
				$(this).addClass('active').siblings().removeClass('active');
		});

		$("#btn_ds").bind("click", function () {
 			var id=$('.bg_header').attr('data-id');
			var pro_name=$("#pro_name").val();
			var title=$("#title").val();
			var unit_price=$("#unit_price").val();
			var task_num=$("#task_num").val();
			var submittime=$("#sel01").val();
			var periodtime=$("#sel02").val();
			var category_id=$("#category_id").val();
			var chongzuo = $(".active").data("chongzuo");
			var count=$("#count_money").val();
            // var biaoti=localStorage.getItem('type');
            // alert(id);
			
			if(pro_name.trim()==""){
            myalert('请填写项目名称！','','error');
            return false;
			}
			
			if(title.trim()==""){
				myalert('请填写任务标题！','','error');
				return false;
			}
			 if(unit_price.trim()==""){
				myalert('请输入悬赏单价！','','error');
				return false;
			}
			if(task_num.trim()==""){
				myalert('请输入悬赏数量！','','error');
				return false;
			}


			$.ajax({
                type:"post",
                url:"adds",
                data:{pro_name:pro_name,title:title,unit_price:unit_price,ticket_num:task_num,submittime:submittime,periodtime:periodtime,chongzuo:chongzuo,category_id:category_id,count:count,id:id},
                success:function(ret){
                	var json=JSON.parse(ret);
            	// var type=json.type;
            	if(json.code==0){
					myalert(json.msg);
					var type=json.type;
					location.href="http://www.tp.com/thinkphp5/public/index.php/index/renwu/release?type="+type+"&&pro_name="+pro_name;
            	}else{
            		myalert(json.msg);
            	}
                }
     //            ,
     //            error:function(ret){
					// myalert(ret);
     //            }
            })
        });
		
	})


	
</script>



<script type="text/javascript">


$(function () {
//校验数量
    $("#task_num").bind('input propertychange', function() {
        var task_num = $(this).val();
        var r = /^[0-9]*[1-9][0-9]*$/;
        if(task_num==""){
            $("#count_money").val("");
            return false;
        }
        if(!r.test(task_num)){
            myalert('请输入正确的数量！','','error');
            $("#task_num").val("");
            $("#task_num").focus();
            $("#count_money").val("");
            return false;
        }
        var min_number = $("#min_number").val();
        if(parseInt(task_num)<parseInt(min_number)){
            myalert("数量不能低于"+min_number+"！",'','error');
            $("#task_num").val("");
            $("#task_num").focus();
            $("#count_money").val("");
            return false;
        }
        var unit_price = $("#unit_price").val();
        if(unit_price.trim()!=""&&task_num.trim()!=""){
            countMoney(unit_price,task_num);
        }       
    });

	})


	    //计算费用
    function countMoney(unit_price,task_num){
        var fee = parseFloat($("#service_charge").val());
        var service_charge = 1 + fee;
        var count_money = parseFloat(unit_price)*parseFloat(task_num);
        count_money = parseFloat(count_money);
        $('#count_money').val((count_money*service_charge).toFixed(2));
        $("#user_gold").html(count_money.toFixed(2));
        $('#plat_gold').html((count_money*Math.abs(fee)).toFixed(2));
    }
</script>
		
 </body></html>